#ifndef LOGGER_H
#define LOGGER_H
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
            TypeName(const TypeName&); \
            void operator=(const TypeName&)

#include <QObject>
#include <QFile>
#include <QDateTime>
#include <QMessageBox>
#include <QHostAddress>
#include <QDebug>

class Logger
{
public:
    Logger();
    bool isCreated();
    void writeLog(int log);

    enum logType{
        CannotLogIn = 0,
        DbConnectionFaild = 1,
        LoginSuccessfully = 2,
        WrongUserNameOrPassword = 3,
        IPChanged = 4,
        FileOpened = 5,
        DownloadFaild = 6,
        HostConnectionFaild = 7,
        FaildToGetFileInfo = 8,
        SkipForcely = 9,
        Reassemble = 10,
        AssembleSuccessfully = 11,
        LogoutSuccessfully = 12,
        UpdateDbFaild = 13
    };

    void setUsrname(QStringList usrname);
    void setIpAndPort(QString host, unsigned short port);
    void setFileName(QString fileName);
private:
    DISALLOW_COPY_AND_ASSIGN(Logger);
    QFile file;
    QDateTime time;

    QStringList usrname;
    QString host;
    unsigned short port;
    QString fileName;
};

#endif // LOGGER_H
